Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Hardlink Compatibility with Separate Rebalance Script #46

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

hbilbo
Copy link

@hbilbo hbilbo commented Oct 17, 2024

This adds a script which supports rebalancing hardlinked files that are in two separate directories. The two directories are passed as inputs and are treated as source and destination directories. The hardlinks in the "dest" directory are first removed while retaining the file path name. Rebalancing is performed as usual on files in the source directory, then the hardlink is recreated in the destination. The effect is to preserve the original hardlink structure (for inodes that have exactly two links) while only needing to rebalance one of the two hardlinks. This script has only been tested on linux but should also work on macos and freebsd with very little work.

Note that this also removes the option to skip hardlinks in the original "zfs-inplace-rebalance.sh" script and instead makes that the default behavior. No hardlinked files will be processed in that script. It is possible that the scripts could be merged, but for simplicity I've kept them separate for now since "zfs-hardlink-rebalance.sh" requires two directory inputs while "zfs-inplace-rebalance.sh" only requires one.

Hayden Bilbo and others added 4 commits October 14, 2024 11:45
…rectories as inputs.

Modified original zfs-inplace-rebalance.sh script to only process non hard-linked files.
Rebalance Hardlinked Files
…ardlink but exit out if the

checksum flag or the number of passes was changed.
Removed empty quotes in sed command to make compatible with linux
@hbilbo hbilbo mentioned this pull request Oct 17, 2024
@markusressel
Copy link
Owner

Hey @hbilbo , thx for the PR! ❤️

Looks good so far! We have to fix a couple of things before merging this though:

  1. The tests are failing. We need to make sure
    • the existing script behaves like it did before this change
    • and also add tests for the new script
  2. Update the README. People need to know about the two versions and when to choose which, and the limitations of both (f.ex. only two links etc.)

Also it seems like @nickdemise and @Xaelias have expressed interest in such a feature, it would be great if these people could chime in to make sure this PR solves their usecases too. I do not have a usecase for this personally, so I can't really come up with scenarios myself.

@markusressel
Copy link
Owner

Hey @hbilbo !

Would you mind taking a look at this PR?
#48

Seems to me like some synergy between you both would be very productive 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants